import 'package:flutter/cupertino.dart';

/// 路由动画
class FadeRoute extends PageRouteBuilder {
  final Widget page;

  FadeRoute({
    required this.page,
  }) : super(
          //需要跳转到的页面
          pageBuilder: (context, animation, secondaryAnimation) {
            return page;
          },
          transitionDuration: const Duration(milliseconds: 500),
          transitionsBuilder: (context, animation, secondaryAnimation, child) {
            // return SlideTransition(
            //   position: Tween<Offset>(begin: const Offset(1.0, 1.0), end: Offset.zero,).chain(CurveTween(curve: Curves.ease)).animate(animation),
            //   child: SlideTransition(
            //     position: Tween<Offset>(begin: Offset.zero, end: const Offset(-1.0, 0.0),).chain(CurveTween(curve: Curves.ease)).animate(secondaryAnimation),
            //     child: child,
            //   ),
            // );
            return FadeTransition(
              opacity: animation,
              child: child,
            );
          },
        );
}
